﻿<html>
<head>
    <script src="/js/validate.js" type="text/javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="background-color: transparent">
<form id="id-form" name="frm" method="post" action="/storemanagement/store/save" enctype="multipart/form-data">
	
    <input type="hidden" name="id" value="<?= $this->data['STOREID']; ?>" />
	<table >
		<tr>
			<b>Hình ảnh đại diện hoặc Logo cửa hàng ( <font color="red">* </font> )</b>
        </tr>
		
		<tr>
			<td>
        	<input type='button' value="Choose a file" onclick=""/>
			&nbsp;&nbsp;	 &nbsp;&nbsp;	No file chosen
			&nbsp;&nbsp;	 &nbsp;&nbsp;	
			&nbsp;&nbsp;	 &nbsp;&nbsp;	
			&nbsp;&nbsp;	 &nbsp;&nbsp;	
			&nbsp;&nbsp;	 &nbsp;&nbsp;	
			&nbsp;&nbsp;	 &nbsp;&nbsp;	
			&nbsp;&nbsp;	 &nbsp;&nbsp;	
			&nbsp;&nbsp;	 &nbsp;&nbsp;	
        	<input value="Upload" type='button' onclick="uploadimage()" />
        	</td>
			<td>
        	</td>	
        	<td>
        	</td>   
			<td nowrap="nowrap"></td>			
        </tr>		
		
        <tr>
        	<td><b>
        	Tên cửa hàng ( <font color="red">* </font>)
			</b>
			</td>
		</tr>
		<tr>
        	<td colspan="10">
				<input class="inp-form" id="idName" name="name" value="<?=$this->data['NAME']; ?>" type="text"/>
        	</td>
			<td nowrap="nowrap"></td>
        	<td>        	
        	</td>
			<td nowrap="nowrap"></td>
        	<td>        	
        	</td>
        </tr>
        
		<tr>  	
        	<td nowrap="nowrap"><b>Loại cửa hàng</b></td>        	
		</tr>
		<tr>
			<!--Start of combobox-->
			<td colspan="10">                    
				<select style="width: 200px; height:30px" name="storecategoryid" value="">
					<option value="">-- Chọn loại cửa hàng --</option>
					<?php 
						foreach($this->listStoreCategory as $item){
							if($item['PARENTID']==0){
								$level = 0;
								$spaceLevel = "__";
								echo '<option  value="'.$item['STORECATEGORYID'].'" ';
								if($item['STORECATEGORYID'] == $this->data['STORECATEGORYID'])
									echo 'selected';
								else 
									echo '';
								echo '><b>'.$item['NAME'].'</b></option>';
							}
							else {
								echo '<option value="'.$item['STORECATEGORYID'].'" ';
								if($item['STORECATEGORYID'] == $this->data['PARENTID'])
									echo 'selected';
								else 
									echo '';
								echo '><b>|____'.$item['NAME'].'</b></option>';
							}
						}
					?>
				</select>                   
				<br />               
			<!--End of combobox-->
        	</td> 
        	<td>        	
        	</td>
        	<td>        	
        	</td>
		</tr> 
		
		<tr>
        	<td><b>
        	Mô tả chi tiết
			</b>
        	</td>
		</tr>
		<tr>
        	<td colspan="5">
				<textarea rows="15" cols="100" id="iDescription" name="description" >
				</textarea>
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5"><b>
        	Mức giá</b>	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>			
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;			
			Đến
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	</td>
        </tr>
		
		<tr >
        	<td><b>
        	Giờ mở cửa</b>
        	</td>
        	<td >
			</td>
            <td nowrap="nowrap"></td>
        	<td>				
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 2
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>	
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>						
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 3
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>			
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>	
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>							
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 4
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>			
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			
			Đến
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>	
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>							
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 5
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>			
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>	
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>							
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 6
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>			
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>	
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>							
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Thứ 7
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>			
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			&nbsp;&nbsp;	
			Đến
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>	
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>							
        	</td>
        </tr>
		
		<tr >
        	<td colspan="5">
        	Chủ nhật
        	
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			Từ 
        	<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['LOWESTPRICE']; ?>" type="text"/>			
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>			
        	&nbsp;&nbsp;
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			Đến
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>	
			<input class="inp-form" id="iDescription" name="description" value="<?=$this->data['HIGHESTPRICE']; ?>" type="text"/>							
        	</td>
        </tr>
		
		<tr>  	
        	<td><b>Email</b></td>
		</tr>
		<tr>
        	<td colspan="5">
				<input class="inp-form"  type="textbox" id='iEmail' value="" name="email" />
			</td>			
        </tr>
		
		<tr>  	
        	<td><b>Điện thoại</b></td>
		</tr>
		<tr>
        	<td>
				<input class="inp-form" type="textbox" id='iPhone' value="" name="phone" />
			</td>			
        </tr>

		<tr>  	
        	<td><b>Link Facebook</b></td
		</tr>
		<tr>
        	<td>
				<input class="inp-form" type="textbox" id='iFacebookUrl' value="" name="facebookurl" />
			</td>			
        </tr>
		
		<tr>  	
        	<td><b>Địa chỉ Website</b></td>
		</tr>
		<tr>
        	<td>
				<input class="inp-form" type="textbox" id='iSiteUrl' value="" name="siteurl" />
			</td>			
        </tr>
		
		<tr>  	
        	<td><b>Địa chỉ</b> ( Bạn phải ghi địa chỉ thật rõ ràng, chính xác để có thể hiển thị bản đồ)</td>
		</tr>
		<tr>
        	<td>
			<input class="inp-form" type="textbox" id='iAddress' value="" name="address" />
			&nbsp;&nbsp;
			&nbsp;&nbsp;	
			<a onclick="xemBanDo()"><u><i>xem bản đồ</i></u></a>
			</td> 			
        </tr>
		
		<tr>  	
        	<td colspan="5"><b>Quận huyện</b>&nbsp;&nbsp;&nbsp;&nbsp;
			<!--Start of combobox-->
			                  
				<select style="width: 200px; height:30px" id="district_cb" name="district" value="">
					<option value="">-- Chọn quận huyện --</option>
					
				</select>                 
			<!--End of combobox-->
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<b>Tỉnh thành</b>
			&nbsp;&nbsp;
			&nbsp;&nbsp;      	
			
			<!--Start of combobox-->              
				<select style="width: 200px; height:30px" id="city_cb" name="cityid" onchange="if(this.value) changedCity(this.value)">
					<option value="">-- Chọn tỉnh thành --</option>
					<?php 
						foreach($this->listTinhThanh as $item){
								echo '<option  value="'.$item['CITYID'].'" ';
								if($item['CITYID'] == $this->data['CITYID'])
									echo 'selected';
								else 
									echo '';
								echo '><b>'.$item['NAME'].'</b></option>';
						}
					?>
				</select>                   
				<br />               
			<!--End of combobox-->
        	</td> 
		</tr> 
		
        <tr> 
			<td nowrap="nowrap"><b>Bộ sưu tập hình ảnh ( tối đa 7 hình )</b></td>    			
		</tr> 
		
		<tr> 
			<td nowrap="nowrap">Hình ảnh 1 &nbsp;&nbsp;
			&nbsp;&nbsp;
			<input type="button" id='iPicture1' value="chọn file từ máy tính" name="picture1" width="25" />
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			chưa có file được chọn
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<input type="button" id='iUpload1' value="tải lên" name="upload1" width="25" />
			</td>
		</tr> 
		
		<tr> 
			<td nowrap="nowrap">Hình ảnh 2
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<input type="button" id='iPicture2' value="chọn file từ máy tính" name="picture2" width="25" />
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			chưa có file được chọn
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<input type="button" id='iUpload2' value="tải lên" name="upload2" width="25" />
			</td>
		</tr> 
		
		<tr> 
			<td nowrap="nowrap">Hình ảnh 3
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<input type="button" id='iPicture3' value="chọn file từ máy tính" name="picture3" width="25" />			
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			chưa có file được chọn
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<input type="button" id='iUpload3' value="tải lên" name="upload3" width="25" />
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<a onclick="themHinhAnh()"><u><i>thêm hình ảnh</i></u></a>
			</td> 
		</tr> 
		
        <tr>  	
        	<td>Kích hoạt
			&nbsp;&nbsp;
			&nbsp;&nbsp;
			<input type="checkbox" id='iStatus' value="1" name="status" <?php if ($this->data['STATUS'] == 1) echo "checked";?> />
			</td>			
        </tr>
		
		<tr>		
        </tr>	
		
		<tr>			
        	<td>
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;			
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			&nbsp;&nbsp;			&nbsp;&nbsp;			&nbsp;&nbsp;
			<input type='button' value="Cancel" onclick="cancel()"/>
			<input value="Continue" type='button' onclick="continues()" />				
        	<input value="Save" type='button' onclick="save()" />
        	</td>   
			<td>
        
        	</td>	
			<td>
        	</td>	
			<td nowrap="nowrap"></td>			
        </tr>	
   	
	</table>
		
</form>
<script language="JavaScript">
	
    function save(){
        var flag=0;
    	var name= document.getElementById('name');
    	if(name == null || name == ''){
        	alert('Tên cửa hàng không được trống.');
        	flag=1;
        	return;
        	}else{
        		flag=0;
            	}
    	if(flag==0){
				document.frm.submit();
        	}
    	else{
				return;
        	}            
    }
		
	function themHinhAnh(){
		alert("Die!!");
    }	
	
	function xemBanDo(){
		alert("Die!!");
    }	
	
	function continues(){
		alert("Die!!");
    }
	
	function cancel(){
		 document.location.href='/storemanagement/store/index';
    }
	
	function changedCity(cityid){
		//Ajax ở đây.		
		$.ajax({
		url: '/storemanagement/store/selectdistrictbycityid/cityid/'+ cityid+'/districtid/<?php echo $this->data['DISTRICTID']?>',
		success: function(data) {
			if(data){
				$('#district_cb').html('<option value="0">-- Chọn quận huyện --</option>'+ data);
				}
			else
				$('#district_cb').html('<option value="0">-- Chọn quận huyện --</option>');
			}
		});
	}
	<?php if($this->data['CITYID'] != 0) : ?>
		changedCity(<?php echo$this->data['CITYID']?>);
		//changedCity();
	<?php endif; ?>
	
	function back(){
        document.location.href='/storemanagement/store/index';
    }	
	
</script>
</body>
</html>		